using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using Acms.SqlDal;

namespace Acms.Bll
{
    public class UnusedPostControl : BaseItem
    {
        private UnusedPostControl() : base() { }
        private UnusedPostControl(Hashtable table) : base(table) { }
        private UnusedPostControl(Hashtable table, List<UnusedPostControl> collection) : base(table, collection) { }

        protected override Base CreateDal()
        {
            return new UnusedPostControlDal();
        }

        public static UnusedPostControl CreateInstance()
        {
            return new UnusedPostControl();
        }

        private static UnusedPostControl Get(Hashtable table)
        {
            if (table != null)
                return new UnusedPostControl(table);
            else
                return null;
        }

        private static List<UnusedPostControl> Get(Hashtable[] tables)
        {
            if (tables != null)
            {
                List<UnusedPostControl> tmp = new List<UnusedPostControl>();
                foreach(Hashtable table in tables)
                {
                    tmp.Add(new UnusedPostControl(table, tmp));
                }
                return tmp;
            }
            else
                return null;
        }

        public static List<UnusedPostControl> GetAllByPostId(int postId)
        {
            UnusedPostControlDal dal = new UnusedPostControlDal();
            return Get(dal.GetAllByPostId(postId));
        }

        protected override void Load(Hashtable table)
        {
            id = (int)table[UnusedPostControlDal.Fields.PostId];
            postId = (int)table[UnusedPostControlDal.Fields.PostId];
            name = (string)table[UnusedPostControlDal.Fields.Name];
            value = (System.Xml.XmlDocument)table[UnusedPostControlDal.Fields.Value];
            adminControlType = (string)table[UnusedPostControlDal.Fields.AdminControlType];
        }

        private int id;
        public int Id
        {
            get { return id; }
        }

        private int postId;
        public int PostId
        {
            get { return postId; }
        }

        private string name;
        public string Name
        {
            get { return name; }
        }

        private System.Xml.XmlDocument value;
        public System.Xml.XmlDocument Value
        {
            get { return this.value; }
            set { this.value = value; }
        }

        private string adminControlType;
        public string AdminControlType
        {
            get { return adminControlType; }
        }
    }
}
